package com.heima.utils.thread;

import com.heima.model.user.pojos.ApUser;
import com.heima.model.wemedia.pojos.WmUser;

/**
 * app端存储用户信息 ThreadLocal
 */
public class ApUserThreadLocalUtil {
    private final static ThreadLocal<ApUser> AP_USER_THREAD_LOCAL = new ThreadLocal<>();

    //1.存入线程
    public static void setUser(ApUser apUser) {
        AP_USER_THREAD_LOCAL.set(apUser);
    }

    //2.从线程中取出
    public static ApUser getUser() {
        return AP_USER_THREAD_LOCAL.get();
    }

    //3从线程中移除
    public static void clear() {
        AP_USER_THREAD_LOCAL.remove();
    }
}
